//
//  DJDDetViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/9/1.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "DJDDetViewController.h"

#import "DJDDOneView.h"
#import "DJDDTwoView.h"
@interface DJDDetViewController ()

@end

@implementation DJDDetViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = COLOR_RGB(242, 242, 242, 1);
    [self showNav:@"订单详情"];
    [self loadUI];
    [self loadData];
    
}

- (void)loadUI{
    UIScrollView *sclView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64)];
    sclView.contentSize = CGSizeMake(ScreenWidth, 645);
    [self.view addSubview:sclView];
    //
    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 105)];//540_105
    view1.backgroundColor = [UIColor whiteColor];
    [sclView addSubview:view1];
    
    UILabel *lab = [[UILabel alloc] init];
    lab.text = @"订单状态";
    lab.textColor = COLOR_RGB(15, 129, 255, 1);
    lab.font = [UIFont systemFontOfSize:12.0];
    [view1 addSubview:lab];
    [lab makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(view1.centerX);
        make.top.equalTo(view1.top).offset(16);
    }];
    
    UILabel *lab2 = [[UILabel alloc] init];
    lab2.text = @"等待商家接单";
    lab2.font = [UIFont boldSystemFontOfSize:17.0];
    [view1 addSubview:lab2];
    [lab2 makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(lab.centerX);
        make.top.equalTo(lab.bottom).offset(8);
    }];
    
    UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnCancel setTitle:@"取消订单" forState:UIControlStateNormal];
    [btnCancel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    btnCancel.titleLabel.font = [UIFont systemFontOfSize:13.0];
    btnCancel.layer.cornerRadius = 5.0;
    btnCancel.layer.borderWidth = 1.0;
    btnCancel.layer.borderColor = [UIColor redColor].CGColor;
    [view1 addSubview:btnCancel];
    [btnCancel makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(lab.centerX);
        make.top.equalTo(lab2.bottom).offset(8);
        make.width.equalTo(68);
        make.height.equalTo(26);
    }];
    
    DJDDOneView *view2 = [[[NSBundle mainBundle] loadNibNamed:@"DJDDOneView" owner:nil options:nil] lastObject];
    view2.frame = CGRectMake(0, view1.frame.origin.y+view1.frame.size.height+10, ScreenWidth, 310);
    [sclView addSubview:view2];
    
    DJDDTwoView *view3 = [[[NSBundle mainBundle] loadNibNamed:@"DJDDTwoView" owner:nil options:nil] lastObject];
    view3.frame = CGRectMake(0, view2.frame.origin.y+view2.frame.size.height, ScreenWidth, 230);
    [sclView addSubview:view3];
    
}
//苦力完成详情
- (void)loadData{
    [SVProgressHUD show];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:_orderid forKey:@"id"];
    [parmas setObject:_merid forKey:@"merchantid"];
    
    NSString *url = [NSString stringWithFormat:@"%@/App/Ordermanage/cooliedetails",urlHead];
    [[AFHTTPSessionManager manager] POST:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"res:%@",responseObject);
        [SVProgressHUD dismiss];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
        [SVProgressHUD dismiss];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
